package com.woniu.mqwork;

import com.woniu.dto.OrderPayDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class OrderMqProduct {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendMsg(OrderPayDto orderPayDto){

        String exchange = "normal_order_exchange";

        String routingKey = "order.normal.key";

        rabbitTemplate.convertAndSend(exchange, routingKey, orderPayDto);
        log.info("消息发送成功....");

    }
}
